home *** CD-ROM | disk | FTP | other *** search
-
- LAMBDA demonstrates the use of Interrupt 10H, Function 11H, Subfunction 0--
- 'Character Generator--Load User Text Font.' This service is available only
- on EGA and VGA, and on PS/1 & PS/2 emulating VGA.
-
- In other words, this is a technique for drawing a character--or a set of
- characters--and substituting it for the default character(s).
- In this case, we've chosen to draw the Greek character Lambda and put it in
- the position normally occupied by 'Cedilla C', or CHR$(128): Ç .
- So that, after running LAMBDA.COM, pressing Alt+<Numeric Keypad>128 will
- put the Lambda character on the screen. To remove the user-defined
- character(s) and return to the default, you can either reverse the code
- process, or reset the mode. The latter can be done either by calling
- Interrupt 10H, Function 0FH 'Get Mode', immediately followed by
- Interrupt 10H, Function 0H 'Set Mode', or with the DOS MODE command, as
- for example:
-
- C:>MODE CO80
-
- What follows is, first a DEBUG script file for creating LAMBDA.COM. Then a
- line by line explanation of the code, and then the method for 'drawing' a
- character.
-
- To create LAMBDA.SCR, create a text file by that name, then paste the
- following into it:
-
- A 100
- MOV AX,1100
- MOV BH,E
- XOR BL,BL
- MOV CX,1
- MOV DX,80
- MOV BP,114
- INT 10
- INT 20
- DB 0
- DB 0
- DB 0
- DB 18
- DB 30
- DB 30
- DB 30
- DB 70
- DB 6C
- DB C6
- DB C3
- DB 0
- DB 0
- DB 0
-
- N NEWLAMBDA.COM
- RCX
- 23
- W
- Q
-
- up to the line immediately above. Be sure to include the blank line (actually
- a Carriage Return) immediately above the 'N LAMBDA.COM' line.
- Now, provided that DEBUG.COM is in the directory or on the path, type the
- following DOS command:
-
- DEBUG<LAMBDA.SCR
-
- This will create LAMBDA.COM, which you can run from the command line, or
- in DEBUG itself, or any debugger. When run, the program will not display
- anything, and will execute in the blink of an eye. The only way you can check
- whether it works is by typing Alt+128 and getting a Lambda. You can type
- that either at the DOS prompt, or within most text editors.
-
- EXPLANATION
-
- This explanation applies only to those lines in LAMBDA.SCR that are the
- actual Assembly Language code, and not to the DEBUG command lines, like 'A
- 100'.
-
- MOV AX,1100 / Character Generator function & Load User Text Font
- Subfunction
- MOV BH,E / Size of character in pixel lines (14 Decimal)
- XOR BL,BL / Block number -- here: 0
- MOV CX,1 / Number of characters to be loaded -- here 1, but you can
- do a whole alphabet if you wish
- MOV DX,80 / Position in the default character table of character to
- be replaced -- CHR$(128) or 80 Hexadecimal
- MOV BP,114 / ES:BP point to the buffer that holds the character(s)
- definition (In a COM file, ES and all other segment
- registers are initialized to the same all-purpose segment,
- so we need not change it)
- INT 10 / Call BIOS service
- INT 20 / Exit program
- DB 0 / Character definition table, consisting of 14 lines, begins
- here. If we were doing multiple characters, they would
- would be contiguous, with each one being exactly 14 bytes
- long.
- DB 0
- DB 0
- DB 18
- DB 30
- DB 30
- DB 30
- DB 70
- DB 6C
- DB C6
- DB C3
- DB 0
- DB 0
- DB 0
-
- DRAWING THE CHARACTER
-
- The character definition table for Lambda, above, is created by drawing
- an analog of the character on a binary grid. That's not as intimidating as
- it sounds. Look at the grid below. You'll see a Lambda shape in it, as well
- as a direct correspondence between the numeric value of each line and the
- numbers in the character table:
-
- 00000000
- 00000000
- 00000000
- 00011000 = 18H or 24D
- 00110000 = 30H or 48D
- 00110000 = ditto
- 01110000 = 70H or 112D
- 01101100 = 6CH or 108
- 11000110 = C6H or 198
- 11000011 = C3H or 195
- 00000000
- 00000000
- 00000000
-
- Clearly, a reference that translates binary numbers to hex is very helpful
- in doing this.
- Note that three lines are left blank at the bottom for the cursor.
-
- This technique is useful not only for setting up alternate alphabets, but
- also for achieving graphical effect in text mode. This is done by creating
- character cells that are lines or blocks, and then fitting them together
- like a mosaic. For an example, and more on this technique, see _PC Intern_,
- by Michael Tischer, Abacus, Chapter 4.8.2.
-
- This file prepared by
-
- Albert Duro
- CIS # 73757,2167
-